package com.linchaoen.elema.service.impl;

import com.linchaoen.elema.mapper.AddressMapper;
import com.linchaoen.elema.model.entity.Address;
import com.linchaoen.elema.service.AddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AddressServiceImpl implements AddressService {

    @Autowired
    private AddressMapper addressMapper;

    @Override
    public Address getDefaultAddr(Integer userId) {
        return addressMapper.getDefaultAddr(userId);
    }

    @Override
    public List<Address> getAllAddr(Integer uid) {
        return addressMapper.getAllAddr(uid);
    }

    @Override
    public int addAddr(Address address) {
        return addressMapper.addAddr(address);
    }

    @Override
    public int setDefaultAddr(Integer uid, Integer id) {
        return addressMapper.setDefaultAddr(uid, id);
    }

    @Override
    public int setNoDefault(Integer uid, Integer id) {
        return addressMapper.setNoDefault(uid, id);
    }

    @Override
    public int deleteAddr(Integer uid, Integer id) {
        return addressMapper.deleteAddr(uid, id);
    }

    @Override
    public int updateAddr(Address addr) {
        return addressMapper.updateAddr(addr);
    }
}
